exports.setCaptain = async (req, res, next) => {
  try {
    const sql = `SELECT u.id, u.user_name, COUNT(i.likes) AS like_count FROM fa_users u
  LEFT JOIN fa_images i ON u.id = i.user_id
  GROUP BY u.id
  ORDER BY like_count DESC
  LIMIT 1`;
    const [user] = await global.query(sql);
    console.log("user----", user.id);
    if (user.length > 0) {
      const captain = users[0];
      res.cc(
        `队长已设置为：${captain.user_name}，点赞数：${captain.like_count}`
      );
    } else {
      res.cc("没有找到合适的队长，可能是因为还没有用户或点赞记录。");
    }
  } catch (error) {
    global.logger.error({
      status: 500,
      message: "设置队长时发生错误" + error,
    });
    res.cc("设置队长时发生错误", error);
  }
};
